<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/12
  Time: 10:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String msg = "";
    String temp = (String) request.getAttribute("msg");
    if (temp != null){
        msg = temp;
    }
    //获得Cookie
    String uname="";
    Cookie[] cookies = request.getCookies();
    if (cookies!= null){
        for (Cookie c : cookies){
            //找到cookie名为username的对应的值
            if ("username".equals(c.getName())){
               uname= c.getValue();
            }
        }
    }
%>
<%=msg%>
<form action="/jspTest/loginServlet" method="post">
    用户名: <input type="text" name="username" value="<%=uname%>"> <br>
    密 码: <input type="text" name="password" value=""> <br>
    <input type="submit" value="登录">
</form>
</body>
</html>
